package com.ffr.controller;

import com.ffr.common.core.domain.AjaxResult;
import com.ffr.domain.Test;
import com.ffr.service.TestService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author hkn
 * @描述
 * @date 2024/10/21 13:39
 */
@RestController
@RequestMapping("/test1")
public class Test1Controller {
    @Resource
    private TestService testService;
    /**
     * 添加数据
     */
    @GetMapping
    public AjaxResult add(){
        try {
            Test test =new Test();
            test.setName("haha");
           return AjaxResult.success(testService.save(test));
        } catch (Exception e) {

            return AjaxResult.error(e.getMessage());
        }
    }
}
